/**
 * by samsun
 * 显示业务对象视图
 */
function drawDomainModel(startx,starty,ctx,attributeStore,stateStore,text){
	 ctx.restore();
	 ctx.clearRect(0, 0, 800, 800);
	 ctx.save();
	 ctx.translate(startx, starty);
	 var aAmount=attributeStore.getCount();
	 var sAmount=stateStore.getCount();
	 var length=(aAmount+sAmount+1)*20; 
	 var gradient = ctx.createLinearGradient(0, 0, 0, length);
	 gradient.addColorStop(0, 'rgb(255, 255, 140)');
	 gradient.addColorStop(1, 'rgb(255,255,240)');
	 ctx.fillStyle = gradient;
	 ctx.fillRect( 0, 0, 200, length); //渐变的背景色
	 
	 ctx.strokeStyle = '#000000'; 
	 ctx.beginPath(); 
	 ctx.rect(0.5,0.5, 200, length);
	 ctx.stroke();              //黑边框
	 
	 var classImage=new Image();
	 classImage.onload=function(){
	 ctx.drawImage(classImage,3,2,16,16);
      };
	 classImage.src='images/modelUnit/domainModel/class.gif';
	 
	 ctx.fillStyle ="black";
	 ctx.font = "10pt 宋体";
	 ctx.fillText(text,28,16,170); //标题栏
	 
	 ctx.beginPath();
	 ctx.moveTo(0,20);
	 ctx.lineTo(200,20);
	 ctx.stroke();   
	 ctx.beginPath();
	 ctx.moveTo(0.5,20.5);
	 ctx.lineTo(200.5,20.5);
	 ctx.stroke();        //画分割线
	 
	 
	 var attributeImg=new Image();        //填写属性列表
	 attributeImg.onload=function(){
	 for (var i=0;i<aAmount;i++){
		
		 
		 ctx.drawImage(attributeImg,3,20+i*20,16,16);
		 ctx.fillStyle ="black";
		 ctx.font = "10pt Arial";
		 var record=attributeStore.getAt(i);
		 ctx.fillText(record.get('enName')+': '+record.get('enType'),22,36+i*20,175); //属性栏
	 }
	 };
	 attributeImg.src='images/modelUnit/domainModel/attribute.gif';
	 ctx.beginPath();
	 ctx.lineWidth = 1;
	 ctx.moveTo(0,20+aAmount*20);
	 ctx.lineTo(200,20+aAmount*20);
	 ctx.stroke();   
	 ctx.beginPath();
	 ctx.moveTo(0.5,20+aAmount*20+0.5);
	 ctx.lineTo(200.5,20+aAmount*20+0.5);
	 ctx.stroke();  //画分割线
	 
	  var stateImg=new Image();         //填写状态表
	     stateImg.onload=function(){ 
	     for (var j=0;j<sAmount;j++){
			 ctx.drawImage(stateImg,3,(aAmount+1+j)*20,16,16);
			 ctx.fillStyle ="black";
			 var record=stateStore.getAt(j);
			 ctx.font = "10pt Arial";
			 ctx.fillText(record.get('cnName')+': '+record.get('enName'),22,+(aAmount+1+j)*20+16,175); //属性栏
		 }
	     };
	     stateImg.src='images/modelUnit/domainModel/state.gif';
	 
}